/**
 * 
 */
package Day2;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

/**
 * 
 * @author blank
 *
 */
public class lockString {

	/**
	 * 
	 * 
	 * 
	 * abc def hij 第一次加密：fgh ijk lmn 对应每个字符 向后移5  如果到头从a从新开始   第二次加密：hgf kji nml
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String beforLock="abc def hij";
		char[] cs =beforLock.toCharArray();
		List first =new ArrayList<>();
		for(char c:cs) {
			if(c==32) {
				first.add((int)c);
				continue;
				
			}
			if((c+5)>122) {
				first.add((c+5));
			}else {
				first.add((c+5));
			}
		}
System.out.println(first);
Object[] newStr=first.toArray();
StringBuffer s=new StringBuffer();
for (Object object:newStr) {
	char c= (char)((int)object);
	s.append(c);
}System.out.println(s);

//二次加密
String[] second =s.toString().split("\\s");
List newStrList =new ArrayList<>();
for (String string:second) {
	StringBuffer sb =new StringBuffer(string);
	newStrList.add(sb.reverse().toString());
}
System.out.println(newStrList);
System.out.println(String.join(" ", newStrList));
	}
}

